package com.bitoon.basketdudes.jpa;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * @author paco FELC 2010
 */
@Entity
@Table(name = "palmares", schema = "rankings")
@NamedQueries({
    @NamedQuery(name = "Palmares.findAll", query = "SELECT p FROM Palmares p"),
    @NamedQuery(name = "Palmares.findByEquipoId", query = "SELECT p FROM Palmares p WHERE p.palmaresPK.equipoId = :equipoId"),
    @NamedQuery(name = "Palmares.findByTorneoId", query = "SELECT p FROM Palmares p WHERE p.palmaresPK.torneoId = :torneoId"),
    @NamedQuery(name = "Palmares.findByFecha", query = "SELECT p FROM Palmares p WHERE p.palmaresPK.fecha = :fecha")})

public class Palmares implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PalmaresPK palmaresPK;
    @Column(name = "temporada_id")
    private Integer temporadaId;
    @Column(name = "trofeo_id")
    private Integer trofeoId;
    @Column(name = "posicion")
    private Short posicion;

    public Palmares() {
    }

    public Palmares(PalmaresPK palmaresPK) {
        this.palmaresPK = palmaresPK;
    }

    public Palmares(int equipoId, int torneoId, Date fecha) {
        this.palmaresPK = new PalmaresPK(equipoId, torneoId, fecha);
    }

    public PalmaresPK getPalmaresPK() {
        return palmaresPK;
    }

    public void setPalmaresPK(PalmaresPK palmaresPK) {
        this.palmaresPK = palmaresPK;
    }

    public Integer getTemporadaId() {
        return temporadaId;
    }

    public void setTemporadaId(Integer temporadaId) {
        this.temporadaId = temporadaId;
    }

    public Integer getTrofeoId() {
        return trofeoId;
    }

    public void setTrofeoId(Integer trofeoId) {
        this.trofeoId = trofeoId;
    }

    public Short getPosicion() {
        return posicion;
    }

    public void setPosicion(Short posicion) {
        this.posicion = posicion;
    }

    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (palmaresPK != null ? palmaresPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Palmares)) {
            return false;
        }
        Palmares other = (Palmares) object;
        if ((this.palmaresPK == null && other.palmaresPK != null) || (this.palmaresPK != null && !this.palmaresPK.equals(other.palmaresPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "paco.Palmares[palmaresPK=" + palmaresPK + "]";
    }

}
